using DL.UIBinding;
using TMPro;
using UnityEngine;

namespace DL.UI
{
    public class DebugPage : AbstractPage
    {
        

        #region ui component
        [SerializeField] private TMP_Text text_movementVelocity;
        [SerializeField] private TMP_Text text_verticalVelocity;
        [SerializeField] private TMP_Text text_currentMoveState;
        [SerializeField] private TMP_Text text_currentBattleState;
        [SerializeField] private TMP_Text text_currentTarget;

        private void Reset()
        {
            text_movementVelocity = transform.Find("Image/text_movementVelocity").GetComponent<TMP_Text>();
            text_verticalVelocity = transform.Find("Image/text_verticalVelocity").GetComponent<TMP_Text>();
            text_currentMoveState = transform.Find("Image/text_currentMoveState").GetComponent<TMP_Text>();
            text_currentBattleState = transform.Find("Image/text_currentBattleState").GetComponent<TMP_Text>();
            text_currentTarget = transform.Find("Image/text_currentTarget").GetComponent<TMP_Text>();
        }

        #endregion

        
        #region Property movementVelocity
        private readonly Property<string> _privatemovementVelocityproterty = new();

        public string movementVelocity
        {
            get => _privatemovementVelocityproterty.GetValue();
            set => _privatemovementVelocityproterty.SetValue(value);
        }
        #endregion
        #region Property verticalVelocity

        private readonly Property<string> _privateverticalVelocityproterty = new();

        public string verticalVelocity
        {
            get => _privateverticalVelocityproterty.GetValue();
            set => _privateverticalVelocityproterty.SetValue(value);
        }

        #endregion
        #region Property currentMoveState

        private readonly Property<string> _privatecurrentMoveStateproterty = new();

        public string currentMoveState
        {
            get => _privatecurrentMoveStateproterty.GetValue();
            set => _privatecurrentMoveStateproterty.SetValue(value);
        }

        #endregion
        #region Property currentBattleState

        private readonly Property<string> _privatecurrentBattleStateproterty = new();

        public string currentBattleState
        {
            get => _privatecurrentBattleStateproterty.GetValue();
            set => _privatecurrentBattleStateproterty.SetValue(value);
        }

        #endregion

        #region Property currentTarget

        private readonly Property<string> _privatecurrentTargetproterty = new();

        public string currentTarget
        {
            get => _privatecurrentTargetproterty.GetValue();
            set => _privatecurrentTargetproterty.SetValue(value);
        }

        #endregion

        public override void OnCreate()
        {
            text_movementVelocity = transform.Find("Image/text_movementVelocity").GetComponent<TMP_Text>();
            text_verticalVelocity = transform.Find("Image/text_verticalVelocity").GetComponent<TMP_Text>();
            text_currentMoveState = transform.Find("Image/text_currentMoveState").GetComponent<TMP_Text>();
            text_currentBattleState = transform.Find("Image/text_currentBattleState").GetComponent<TMP_Text>();
            text_currentTarget = transform.Find("Image/text_currentTarget").GetComponent<TMP_Text>();

            _privatemovementVelocityproterty.OnChange += change => { text_movementVelocity.text = movementVelocity; };
            _privateverticalVelocityproterty.OnChange += change => { text_verticalVelocity.text = verticalVelocity; };
            _privatecurrentMoveStateproterty.OnChange += change => { text_currentMoveState.text = currentMoveState; };
            _privatecurrentBattleStateproterty.OnChange += change => { text_currentBattleState.text = currentBattleState; };
            _privatecurrentTargetproterty.OnChange += change => { text_currentTarget.text = currentTarget; };
        }
        
        public override void OnBringIn()
        {
            
            
        }
    }
}
